convert string into array using from() method in javascript